package com.ruoyi.common.utils;

import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.spring.SpringUtils;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.concurrent.TimeUnit;

public abstract class BaseSmsSend {
    public abstract SmsSendResponse send(String phones, String content) throws UnsupportedEncodingException;

    public SmsSendResponse sendVerificationCode(String mobile, String code) throws UnsupportedEncodingException {
        RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
        redisCache.setCacheObject("SmsVerificationCode:" + mobile, code, 5, TimeUnit.MINUTES);
        String content = "您的验证码为：" + code + "，请妥善保管。";
        return send(mobile, content);
    };

    public abstract List<SmsQueryResponseOrder> query(String smsOrderId);
}
